It has been already disclosed in Japanese Unexamined Patent Publication No. 121973/1990 that the following compounds have herbicidal activities: ##STR2##
However, the herbicidal effects off the compounds disclosed in this publication are not necessarily adequate. The present inventors have conducted extensive researches on pyrimidine or triazine compounds with an aim to develop further improved compounds and as a result, have found that pyrimidine or triazine derivatives of the present invention having a heterocyclic ring introduced exhibit excellent herbicidal effects not only against annual weeds but also against perennial weeds, and they are highly safe to crop plants. The present invention has been accomplished on the basis of this discovery.